package com.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class RegisterController {

    /**
     * RequestParam
     *  required=true:必须传
     * @param userName
     * @param password
     * @return
     */
    @RequestMapping("/register")
    public String register(
            @RequestParam(value = "userName",required = true)String userName,
            @RequestParam(value = "password",required = true,defaultValue = "默认密码")String password,
            @RequestParam(value = "myId",required = true)Integer id,
            String[] hobbies) {


        System.out.println("userName="+userName);
        System.out.println("password="+password);
        System.out.println("id="+id);
        for (String hobby : hobbies) {
            System.out.println("hobby --> " + hobby);
        }
        return "success";
    }

}
